import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk';
import logger from 'redux-logger'
import { ALLSTATES } from '../types/store.d'
const initialState = {
    name: '张三',
    list: []
}

const reducer = (state: ALLSTATES = initialState, action: any) => {
    switch (action.type) {
        case 'setList':
            // state.list = action.list
            return { ...state, list: action.list }

        default:
            return state
    }
}
const store = createStore(reducer, applyMiddleware(thunk, logger))
export default store